package demo.thread;

import demo.service.MakeCertService;
import demo.service.vo.CertRequest;
import demo.service.vo.CertResponse;


public class MakeCertThead implements Runnable{

    protected CertRequest request;
    protected TaskInfo<CertResponse> taskInfo;

    public MakeCertThead(CertRequest request, TaskInfo<CertResponse> taskInfo) {
        this.request = request;
        this.taskInfo = taskInfo;
    }

    @Override
    public void run() {
        MakeCertService service = new MakeCertService();
        CertResponse response = service.makeCert(this.request, false);
        // 添加执行结果
        this.taskInfo.addResult(response);
        // 任务完成计数
        this.taskInfo.countDown();

        //System.out.println(Thread.currentThread().getName() + "-" + " finished " + response.getId() + "-" + response.getSignCert());
    }
}
